package com.guigui.gulimall.product.controller.web;

import com.guigui.gulimall.product.service.SkuInfoService;
import com.guigui.gulimall.product.vo.web.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 商品详情
 * @author xin
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/{skuId}.html")
    public String itemSkuPage(@PathVariable("skuId") Long skuId, Model model) {
        SkuItemVo skuInfoVo = skuInfoService.item(skuId);
        model.addAttribute("item", skuInfoVo);
        System.out.println(skuInfoVo);
        return "item";
    }

}
